<?php

namespace App\Http\Requests\School;

use Illuminate\Foundation\Http\FormRequest;

/**
 * Class EditRole
 * @package App\Http\Requests\School
 */
class EditRole extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'label' => 'required|string',
            'description' => 'required|string',
            'permissions' => 'array'
        ];
    }

    /**
     * @return array
     */
    public function attributes()
    {
        return [
            'label' => '角色名称',
            'description' => '角色说明',
            'permissions' => '角色权限'
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'label.required' => '请填写:attribute',
            'label.string' => ':attribute数据类型错误',
            'description.required' => '请填写:attribute',
            'description.string' => ':attribute数据类型错误',
            'permissions.array' => ':attribute数据类型错误'
        ];
    }
}
